package com.company.thread;

import lombok.extern.slf4j.Slf4j;

/**
 * @description: some desc
 * @author: ruoan
 * @date: 2020/10/24 14:50
 */
@Slf4j(topic = "c.Thread15")
public class Thread15 {


    public static void main(String[] args) {
        class RunnableDemo3 implements Runnable{

            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    log.info(Thread.currentThread().getName()+": {}",i);
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }

        for (int i = 1; i <= 32; i++) {
            Thread t = new Thread(new RunnableDemo3());
            t.setName("t"+i);
            t.start();
            // 100ms 开始一个新线程
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
